import Vue from "vue";
import * as filters from "./filter";
import directives from "./directives";
import { globals } from "@/utils/global";
import constant from "@/constant";
import ElementUI from "element-ui";
import router from "@/router";
import store from "@/store";
import App from "@/app";
import "element-ui/lib/theme-chalk/index.css";
import "./component";

//filter
Object.keys(filters).forEach((key) => Vue.filter(key, filters[key]));

// directive
directives.forEach(({ key, value }) => {
  Vue.directive(key, value);
});

//function constant
[globals, constant].forEach((item) =>
  Object.keys(item).forEach((key) => (Vue.prototype[`$${key}`] = item[key]))
);

Vue.use(ElementUI);

//实例化挂载
new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
